import flask_login
from flask_admin.contrib.sqla import ModelView
from .decorators import admin_required

class MyView(ModelView):

    @admin_required
    def is_accessible(self):
        return flask_login.current_user.is_authenticated